package com.example.myapplication.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.*;
import android.widget.*;
import com.example.myapplication.R;
import android.app.AlertDialog;
public class ManageActivity extends AppCompatActivity {
    private Button tv_back;
    private TextView tv_mian_bar;//返回按钮

    private Button collect;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_manage);
        init();

    }

    private void init(){

        Button button = (Button) findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // 在此处添加逻辑
                Intent intent1=new Intent(ManageActivity.this,activity_chat.class);
                startActivity(intent1);
            }
        });

        //定位信息采集
        collect = (Button) findViewById(R.id.collection);
        collect.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent1=new Intent(ManageActivity.this, PositionActivity.class);
                startActivity(intent1);
            }
        });

        tv_mian_bar = (TextView) findViewById(R.id.tv_main_title);
        tv_mian_bar.setText("Welcome!");

        Button button1 = (Button) findViewById(R.id.button3);
        button1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // 在此处添加逻辑
                Intent intent1=new Intent(ManageActivity.this,MapActivity2.class);
                startActivity(intent1);
            }
        });

        tv_back = (Button) findViewById(R.id.tv_back);

        //返回按钮监听
        tv_back.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
               ManageActivity.this.finish();
            }
        });

        Button button2 = (Button) findViewById(R.id.button4);
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // 在此处添加逻辑
                Intent intent1=new Intent(ManageActivity.this,MapActivity1.class);
                startActivity(intent1);
            }
        });

        Button button3 = (Button) findViewById(R.id.button5);
        button3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // 在此处添加逻辑
                Intent intent1=new Intent(ManageActivity.this,MapActivity3.class);
                startActivity(intent1);
            }
        });

        Button button4 = (Button) findViewById(R.id.button3_details);
        button4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // 在此处添加逻辑
               /* Toast.makeText(ManageActivity.this,
                        "海底捞\tYF301\t火锅\n" +
                                "糯米Tai\tYF302\t泰国菜\n" +
                                "井格重庆火锅\tYF312\t火锅\n" +
                                "云海肴\tYF313\t云南菜\n",
                        Toast.LENGTH_LONG).show();*/

                AlertDialog.Builder builder   = new AlertDialog.Builder(ManageActivity.this);
                builder.setTitle("F3 DETAILS" ) ;
                builder.setMessage("海底捞\tYF301\t火锅\n" +
                        "糯米Tai\tYF302\t泰国菜\n" +
                        "井格重庆火锅\tYF312\t火锅\n" +
                        "云海肴\tYF313\t云南菜\n" ) ;
                builder.setPositiveButton("确认" ,   null );
                builder.show();

            }
        });

        Button button5 = (Button) findViewById(R.id.button4_details);
        button5.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // 在此处添加逻辑
                /*Toast.makeText(ManageActivity.this,
                        "布歌东京\tYF401\t甜品\n" +
                                "满记甜品\tYF402\t甜品\n" +
                                "汉堡王\tYF403\t快餐\n" +
                                "南京大牌档\tYF413\t南京菜\n" +
                                "TASTY西堤\tYF414\t西餐\n" +
                                "俄士厨房\tYF415\t西餐\n",
                        Toast.LENGTH_LONG).show();*/
                AlertDialog.Builder builder   = new AlertDialog.Builder(ManageActivity.this);
                builder.setTitle("F4 DETAILS" ) ;
                builder.setMessage("布歌东京\tYF401\t甜品\n" +
                        "满记甜品\tYF402\t甜品\n" +
                        "汉堡王\tYF403\t快餐\n" +
                        "南京大牌档\tYF413\t南京菜\n" +
                        "TASTY西堤\tYF414\t西餐\n" +
                        "俄士厨房\tYF415\t西餐\n" ) ;
                builder.setPositiveButton("确认" ,   null );
                builder.show();
            }
        });

        Button button6 = (Button) findViewById(R.id.button5_details);
        button6.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // 在此处添加逻辑
               /*Toast.makeText(ManageActivity.this,
                        "汤臣小厨\tYF501\t粤菜\n" +
                                "长安记\tYF502\t陕西菜\n" +
                                "蔡澜港式点心\tYF503\t粤菜\n" +
                                "泸溪河\tYF513\t甜点\n" +
                                "眉州东坡\tYF514\t川菜\n" +
                                "潮汕砂锅粥\tYF515\t粤菜\n",
                        Toast.LENGTH_LONG).show();*/
                AlertDialog.Builder builder   = new AlertDialog.Builder(ManageActivity.this);
                builder.setTitle("F5 DETAILS" ) ;
                builder.setMessage("汤臣小厨\tYF501\t粤菜\n" +
                        "长安记\tYF502\t陕西菜\n" +
                        "蔡澜港式点心\tYF503\t粤菜\n" +
                        "泸溪河\tYF513\t甜点\n" +
                        "眉州东坡\tYF514\t川菜\n" +
                        "潮汕砂锅粥\tYF515\t粤菜\n" ) ;
                builder.setPositiveButton("确认" ,   null );
                builder.show();
            }
        });
    }
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.auxi, menu);
        return true;
    }

    public boolean onOptionsItemSelected(MenuItem item) {
        int itemId = item.getItemId();

        if(itemId==R.id.setting_item){
            Intent intent1=new Intent(ManageActivity.this,activity_setting.class);
            startActivity(intent1);
        } else if(itemId==R.id.history_item){
            Intent intent2=new Intent(ManageActivity.this,activity_history.class);
            startActivity(intent2);
        } else if (itemId==R.id.logout_item) {
            Intent intent3=new Intent(ManageActivity.this,activity_login.class);
            startActivity(intent3);
        } else if (itemId==R.id.profile_item) {
            Intent intent4=new Intent(ManageActivity.this,ProfileActivity.class);
            startActivity(intent4);
        }
        return true;
    }

}